package com.liangdemo.web.upload;

import com.liangdemo.web.utils.ajax.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件上传
 * 上传图片，并回显
 *
 * @author Mr.Liang
 * @date 2022/5/24 15:27
 */
@RestController
public class UploadController {
    @Autowired
    private UploadUtils uploadUtils;

    /**
     * 文件上传
     */
    @PostMapping("/uploadTaskFile")
    public AjaxResult uploadFile(MultipartFile file) {
        AttachmentFile attachmentFile = uploadUtils.uploadManageFile(file);
        return AjaxResult.success(attachmentFile);
    }
}
